<template>
  <div class="row-list">
    <div class="tb-head">
      <div class="item"><span class="title">订单号：</span><span class="msg">{{order.orderno}}</span></div>
      <div class="item act">团</div>
      <div class="item"><span class="title">下单时间：</span><span class="msg">{{order.cratetime}}</span></div>
      <div class="item"><span class="title">收货人：</span><span class="msg">{{order.username}}</span></div>
      <div class="item"><span class="title">手机：</span><span class="msg">{{order.userphone}}</span></div>
      <div class="item" v-if="order.delivertype === 2"><span class="title">取货门店：</span><span class="msg">{{order.useraddress}}</span></div>
      <div class="item" v-if="order.delivertype === 1"><span class="title">收货地址：</span><span class="msg">{{order.useraddress}}</span></div>
    </div>
    <div class="order-msg">
      <div class="row">
        <div class="row-item" v-for="item in order.orderGoods" :key="item.id">
          <div class="img"><img :src="`http://image.jiaowawang.cn/${item.goodsimg}`" /></div>
          <div class="name">{{item.goodsname}}</div>
          <div class="num">x{{item.goodsnum}}</div>
          <div class="price">{{comConfig.mark}}{{item.goodsprice}}</div>
        </div>
      </div>
      <div class="right-status">
        <div class="totalPay">{{comConfig.mark}}{{order.realtotalmoney}}</div>
        <div class="status item">
          <span v-if="order.type === 2">团状态</span>
          <span>{{ order.orderstatus | scOrderStatus }}</span>
        </div>
        <div class="btn item">
          <el-button type="text" @click="toDetail(order.id)">查看</el-button>
          <el-button v-if="order.type === 2" type="text">删除</el-button>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props:{
    order: {
      type: Object,
      default: () => {}
    }
  },
  methods: {
    toDetail(oId) {
      this.$router.push({
        path: '/main/sc_order/orderDetail',
        query: { oId }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
  .row-list{
    width: 100%;
    .tb-head{
      display: flex;
      align-items: center;
      height: 36px;
      padding: 0 10px;
      background: #f5f5f5;
      .item{
        margin-right: 20px;
        &.act{
          color: red;
        }
        .title{
          color: #999;
        }
        .msg{
          font-weight: 600;
        }
      }
    }
    .order-msg{
      display: flex;
      justify-content: space-between;
      border:1px solid #f5f5f5;
      .row{
        flex: 1;
        border-right: 1px solid #f5f5f5;
        .row-item{
          display: flex;
          align-items: center;
          padding:5px;
          border-bottom: 1px solid #f5f5f5;
          &:last-child{
            border-bottom: none;
          }
          .img{
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f5f5f5;
            img{
              max-width: 100%;
              max-height: 100%;
            }
          }
          .name{
            flex: 1;
            text-align: left;
            margin:0 20px;
            font-weight: 600;
          }
          .num{
            min-width: 60px;
            text-align: right;
            color: #999;
          }
          .price{
            margin-left: 20px;
            min-width: 120px;
            text-align: right;
            color: #000;
          }
        }
      }
      .right-status{
        display: flex;
        .item{
          width: 80px;
          padding: 0 10px;
          display: flex;
          flex-flow: column;
          align-items: center;
          justify-content: center;
        }
        .totalPay{
          padding: 0 10px;
          display: flex;
          align-items: center;
          justify-content: flex-end;
          min-width: 80px;
        }
        .btn{
          button {
            margin: 0!important;
          }
        }
        .status{
          border-left: 1px solid #f5f5f5;
          border-right: 1px solid #f5f5f5;
        }
      }
    }
  }
</style>